<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    //async函数百分百要返回一个promise
    async function test() {
        /*return new Promise((resolve,reject)=>{
            resolve(1)
        })*/
        /*await new Promise((resolve,reject)=>{
            setTimeout(()=>{
                resolve(1)
            },2000)
        })
        return 1;*/

        new Promise((resolve,reject)=>{
            setTimeout(()=>{
                resolve(1)
            },2000)
        }).then(()=>{
            return 1;
        })
    }








    //Promise.resolve(1)
    //Promise.resolve(new Promise((resolve,reject)=>{
    //    resolve(1)
    //}))
    var res = test()
    console.log(res);
</script>
</html>